<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateGoodsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('goods', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('cate_id')->comment('所属分类ID');
            $table->foreign('cate_id')
                ->references('id')->on('good_cates');
            $table->string('name')->comment('商品名称');
            $table->integer('price')->comment('市场价');
            $table->integer('price_agent_one')->comment('一级代理价格');
            $table->integer('price_agent_two')->comment('二级代理价格');
            $table->text('detail')->nullable()->default(null)->comment('商品详情');
            $table->string('good_img', 255)->comment('商品图片');
            $table->string('good_img_small', 255)->comment('商品缩略图');
            $table->integer("created_at");
            $table->integer("updated_at");
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('goods');
    }
}
